home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / surfsrc3.zip / WIREFRAM.INC < prev    next >
Text File  |  1991-09-28  |  2KB  |  76 lines

  1. procedure WIREFRAME;
  2.  
  3. { Make a wireframe drawing of the object }
  4. var Node:                      word;          { node # }
  5.     Surf:                      word;          { surface # }
  6.     User_abort:                boolean;       { did the user abort? }
  7.     ch:                        char;
  8. label ABORTTEXT,                              { text-mode abort }
  9.       ABORTGRPH;                              { graphics-mode abort }
  10.  
  11. begin
  12. {$ifdef BIGMEM}
  13. with ptra^ do with ptrb^ do with ptrc^ do
  14. with ptrd^ do with ptre^ do with ptrf^ do
  15. with ptri^ do
  16. begin
  17. {$endif}
  18.   perf_start;
  19.   User_abort := TRUE;
  20.   if (Viewchanged) then begin
  21.     menumsg ('Transforming to 2-D...');
  22.     if (checkey) then goto ABORTTEXT;
  23. { Transform from 3-D to 2-D coordinates }
  24.     setorigin;
  25.     for Node := 1 to Nnodes do
  26.       perspect (Xworld[Node], Yworld[Node], Zworld[Node],
  27.                 Xtran[Node],  Ytran[Node],  Ztran[Node]);
  28.  
  29. { Set plotting limits and normalize transformed coords to screen coords }
  30.     perspect (Xfocal, Yfocal, Zfocal, Xfotran, Yfotran, Zfotran);
  31.     if (not setnormal (Xfotran, Yfotran, XYmax)) then begin
  32.       menumsg ('Warning: Focal point outside data limits.');
  33.       writeln;
  34.       write   ('  Press any key ...');
  35.       ch := readkey;
  36.     end;
  37.  
  38.     if (checkey) then goto ABORTTEXT;
  39. { Normalize all the nodes }
  40.     for Node := 1 to Nnodes do
  41.       normalize (Xtran[Node], Ytran[Node], Xfotran, Yfotran, XYmax);
  42.   end; { if Viewchanged }
  43.  
  44. {$ifdef USE_IFF}
  45.   menumsg ('Plotting...');
  46. {$endif}
  47.  
  48. { Draw the outline of each surface }
  49.   setgmode (Nmatl);
  50.   for Surf := 1 to Nsurf do begin
  51.     border (Surf, Matl[Surf]);
  52.     if (grafstat) then goto ABORTGRPH;
  53.   end;
  54.   drawaxes (Xfotran, Yfotran, XYmax);
  55.  
  56.   perf_stop (2);
  57.  
  58. {$ifdef USE_IFF}
  59.   menumsg ('Saving IFF...');
  60.   saveiff (Filemask + '.IFF', VGApal);
  61. {$else}
  62.   { Wait for user keypress to continue }
  63.   continue;
  64. {$endif}
  65.   User_abort := FALSE;
  66.  
  67.   ABORTGRPH:
  68.   exgraphic;
  69.   ABORTTEXT:
  70.   if (User_abort) then
  71.     perf_stop (0);
  72. {$ifdef BIGMEM}
  73. end; {with}
  74. {$endif}
  75. end; {procedure WIREFRAME }
  76.